__author__ = 'tarek'

#script that takes the NASDAQ CSV file and imports it into the database


from twitterSentiment.models import Company
import pandas as pd
allcompaniescsv = 'data/allpubliccomp.csv'

def run():
	allcompanies = pd.read_csv(allcompaniescsv)

	for idx,row in allcompanies.iterrows():
		aCompany = Company(
			symbol = row["Symbol"],
			name = row["Name"],
			lastSale = row["LastSale"],
			marketCap = row["MarketCap"],
			adrTso = row["ADR TSO"],
			ipoYear = row["IPOyear"],
			sector = row["Sector"],
			industry = row["industry"],
			summaryQuote = row["Summary Quote"],
			exchange = row["exchange"],
			date_extracted = row["dateextracted"]
		)
		aCompany.save()
